<?php
/* @var $this SiteController */

$this->pageTitle = Yii::app()->name;
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->baseUrl . '/assets/main/js/pages/index.js', CClientScript::POS_END);
?>
<?php if (isset($bannerTop) && !empty($bannerTop)) { ?>
    <div class="tp-banner-container">
        <div class="tp-banner">
            <ul>
                <?php
                foreach ($bannerTop as $banner) {
                    echo CHtml::openTag("li", array("data-transition" => '3dcurtain-vertical', 'data-slotamount' => '7', "data-masterspeed" => '300')) . "\n";
                    echo CHtml::openTag("img", array("src" => Yii::app()->request->baseUrl . $banner->content_dtl, "atl" => $banner->title, 'data-bgfit' => 'cover', 'data-bgposition' => 'left top', 'data-bgrepeat' => 'no-repeate'));
                    echo CHtml::closeTag("li");
                }
                ?>

            </ul>
        </div>
    </div>
<?php } ?>
<?php if (isset($bestSells) && !empty($bestSells)) { ?>
    <section class="block">
        <div class="container">
            <div class="heading1">
                <h2><i>MOST SOLD </i>ITEMS</h2>
            </div>
            <div id="most-solded">
                <?php
                $count = 0;
                foreach ($bestSells as $bestSell) {
                    if ($count == 0) echo CHtml::openTag("div", array("class" => "row")) . "\n";
                    echo CHtml::openTag("div", array("class" => "col-md-3")) . "\n";
                    echo CHtml::openTag("div", array("class" => "best-seller most-sold")) . "\n";
                    echo CHtml::openTag("div", array("class" => "sold-thumb")) . "\n";
                    echo CHtml::openTag("img", array("class" => 'lazyLoad', "atl" => $bestSell['PRODUCT_NAME'], 'data-src' => Yii::app()->request->baseUrl . '/assets/main/images/up-coming4.jpg'));
                    echo CHtml::openTag("a", array("href" => '#', "title" => $bestSell['PRODUCT_NAME']));
                    echo 'VIEW DETAILS';
                    echo CHtml::closeTag("a");
                    echo CHtml::openTag("i", array("class" => "box1")) . "\n";
                    echo CHtml::closeTag("i");
                    echo CHtml::openTag("i", array("class" => "box2")) . "\n";
                    echo CHtml::closeTag("i");
                    echo CHtml::openTag("i", array("class" => "box3")) . "\n";
                    echo CHtml::closeTag("i");
                    echo CHtml::openTag("i", array("class" => "box4")) . "\n";
                    echo CHtml::closeTag("i");
                    echo CHtml::closeTag("div");
                    echo CHtml::openTag("h3");
                    echo $bestSell['PRODUCT_NAME'];
                    echo CHtml::closeTag("h3");
                    echo CHtml::closeTag("div");
                    echo CHtml::closeTag("div");
                    if ($count >= 5 || $bestSell == end($bestSells)) echo CHtml::closeTag("div");
                    if ($count < 5)
                        $count++;
                    else
                        $count = 0;
                }
                ?>

            </div>

        </div>
    </section>
<?php } ?>

<?php if (isset($lasts) && !empty($lasts)) { ?>
    <section class="block remove-gap">
        <div class="container">
            <div class="heading1">
                <h2><i>LATEST PHONE </i>ITEMS</h2>
            </div>
            <div class="rows">
                <?php
                $count = 0;
                foreach ($lasts as $lastItem) {
                    echo CHtml::openTag("div", array("class" => "col-md-3")) . "\n";
                    echo CHtml::openTag("div", array("class" => "best-seller most-sold")) . "\n";
                    echo CHtml::openTag("div", array("class" => "sold-thumb")) . "\n";
                    echo CHtml::openTag("img", array("class" => 'lazyLoad', "atl" => $lastItem['PRODUCT_NAME'], 'data-src' => Yii::app()->request->baseUrl . '/assets/main/images/up-coming4.jpg'));
                    echo CHtml::openTag("a", array("href" => '#', "title" => $lastItem['PRODUCT_NAME']));
                    echo 'VIEW DETAILS';
                    echo CHtml::closeTag("a");
                    echo CHtml::openTag("i", array("class" => "box1")) . "\n";
                    echo CHtml::closeTag("i");
                    echo CHtml::openTag("i", array("class" => "box2")) . "\n";
                    echo CHtml::closeTag("i");
                    echo CHtml::openTag("i", array("class" => "box3")) . "\n";
                    echo CHtml::closeTag("i");
                    echo CHtml::openTag("i", array("class" => "box4")) . "\n";
                    echo CHtml::closeTag("i");
                    echo CHtml::closeTag("div");
                    echo CHtml::openTag("h3");
                    echo $lastItem['PRODUCT_NAME'];
                    echo CHtml::closeTag("h3");
                    echo CHtml::closeTag("div");
                    echo CHtml::closeTag("div");

                }
                ?>
            </div>
        </div>
    </section>
<?php } ?>

<?php if (isset($brands) && !empty($brands)) { ?>
    <section id="brands">
        <div class="fixed-img sec-bg3"></div>
        <div class="container">
            <span style="z-index: 10"><i>OUR</i> BRANDS</span>

            <div class="brands">
                <?php
                foreach ($brands as $brand) {
                    echo CHtml::openTag("a", array("title" => $brand->title)) . "\n";
                    echo CHtml::openTag("img", array("class" => 'lazyOwl', "atl" => $brand->title, 'data-src' => Yii::app()->request->baseUrl . $brand->content_dtl));
                    echo CHtml::closeTag("a");
                }
                ?>
            </div>
        </div>

    </section>
<?php } ?>